//
//  GuideControl.m
//  FreeTime
//
//  Created by  on 16/9/2.
//  Copyright © 2016年 SRDZ.com. All rights reserved.
//

#import "GuideControl.h"
#import "Header.h"
#import "LoginControl.h"
@interface GuideControl (){
    UIScrollView * scrollView;

}

@end

@implementation GuideControl

- (void)viewDidLoad {
    [super viewDidLoad];
    [self setupUI];
    
}
- (void)setupUI{
    NSArray * arr = @[@"123",@"123",@"123"];
    scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, WindowWidth, WindowHeight)];
    scrollView.contentSize = CGSizeMake(arr.count*WindowWidth, WindowHeight);
    scrollView.pagingEnabled = YES;
    for (int i =0; i<arr.count; i++) {
        UIImageView * imageV = [[UIImageView alloc] initWithFrame:CGRectMake(i*WindowWidth, 0, WindowWidth, WindowHeight)];
        imageV.userInteractionEnabled = YES;
//        UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapPhoto)];
//        [imageV addGestureRecognizer:tap];
        imageV.image = [UIImage imageNamed:@"123"];
        [scrollView addSubview:imageV];
        if (i==2) {
            UIButton * btn = [UIButton buttonWithType:UIButtonTypeSystem];
            btn.frame = CGRectMake((WindowWidth-100)/2, WindowHeight-140, 100, 40);
            [btn setTitle:@"进入应用" forState:UIControlStateNormal];
            [btn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
            [btn addTarget:self action:@selector(openApp) forControlEvents:UIControlEventTouchUpInside];
            btn.titleLabel.font = FONT(15);
//            btn.backgroundColor = [ui]
            btn.layer.cornerRadius = 5;
            btn.layer.borderColor = [UIColor whiteColor].CGColor;
            btn.layer.borderWidth = 0.5;
            [imageV addSubview:btn];
            
        }
    }
    [self.view addSubview:scrollView];
}
- (void)openApp
{
    LoginControl * login = [LoginControl new];
    [self presentViewController:login animated:YES completion:nil];
    
//    AppDelegate * delegate = [UIApplication sharedApplication].delegate;
//    delegate.window.rootViewController = [delegate creatTab];
    
}

@end
